# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=m4
pkgver=1.4.19
pkgrel=1
pkgdesc="GNU macro processor"
url="https://www.gnu.org/software/m4"
depends=
makedepends=texinfo
checkdepends=diffutils
arch="all"
license="GPL-3.0+"
subpackages="m4-doc"
source="https://ftp.gnu.org/gnu/m4/$pkgname-$pkgver.tar.gz
	musl-realpath.patch
	fix-sysval-test.patch
	test-posix_spawn_file_actions_addclose.patch
	"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make install DESTDIR="$pkgdir"
	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}

sha512sums="
f5dd0f02fcae65a176a16af9a8e1747c26e9440c6c224003ba458d3298b777a75ffb189aee9051fb0c4840b2a48278be4a51d959381af0b1d627570f478c58f2  m4-1.4.19.tar.gz
cc86f883eac255301615278af9ee172e13bbe48ce0ac318ab6c325ab2406000ceb10c5360868111210eb784ea028ef93cdfe12b77e17fa0066786957c347fd71  musl-realpath.patch
d251842f8a6d71b4dc6912961bd873383b1b102a14ae3c1d06f44444b3db69d599fd8afec436734c4dad1c08de06c2ef2a48582a1528cc67b20f8db5afe287d9  fix-sysval-test.patch
78f78f3f3145515da0a4b6f5fc891b0289b20d25f548d403f7de38f27a4b0f4bf06bf987d994ec85b61f4b28de1494a93c3347ff35b695becf8a5e9f2f3f7d49  test-posix_spawn_file_actions_addclose.patch
"
